package com.learning.netease.distributed.lock.zk;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * ClassName: OrderCodeGenerator
 * Description: 模拟订单编号生成类
 * Date: 2019/3/20 13:20 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class OrderCodeGenerator {

    /**
     * 自增长字段
     */
    private int i = 0;

    /**
     * 模拟自增序列
     *
     * @return
     */
    public String getOrderCode() {
        Date now = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss-");
        return format.format(now) + ++i;
    }
}
